#! /bin/sh

echo "Starting my-eth..."

if [ ! -d "/my-eth/data/keystore" ];then
  echo "Init ETH datadir"
  /my-eth/chain/geth --datadir /my-eth/data init /my-eth/chain/genesis_pow.json
  cp /my-eth/chain/node1-0x85564bfb7d913cc7ca84f3b325cdf239b950c3f5-39.105.18.23.json  /my-eth/data/keystore/
else
  echo "ETH has been inited before"
fi

sleep 5s

/my-eth/chain/geth --datadir /my-eth/data --port "30303" --networkid "99854" --identity "private etherum"                            \
    --http --http.addr 0.0.0.0 --http.port 8545 --http.corsdomain "*" --http.api "eth,web3,miner,admin,debug,txpool,personal,net"    \
    --ws   --ws.addr   0.0.0.0 --ws.port   8546 --ws.origins      "*"  --ws.api  "eth,web3,miner,admin,debug,txpool,personal,net"    \
    --graphql --graphql.corsdomain "*"     --graphql.vhosts "*"  --allow-insecure-unlock --syncmode full                             \
    --mine --miner.threads=1 --miner.etherbase=0x85564bfb7d913cc7ca84f3b325cdf239b950c3f5                                            \
    --unlock 0x85564bfb7d913cc7ca84f3b325cdf239b950c3f5 --password password.txt                                                      \
    --bootnodes "enode://7c6514e5b3efcea6aab9e6b2e5c9b40fcef04d6ad8c3c7456ba8e221246636358c92e8690ad8926db75987f46f07c7e9558a5fe12700a6b8c58ae13cbecd6e76@172.21.117.54:0?discport=33333"


